﻿namespace KingerRobot.MexicoSailunWMS.Spi;

public interface IEquipManageService
{
    /// <summary>
    /// 获取设备信息
    /// </summary>
    /// <param name="equipManagePara"></param>
    /// <returns></returns>
    List<EquipManageBean> GetEquipBeans(EquipManagePara equipManagePara);

    /// <summary>
    /// 获取设备类型
    /// </summary>
    /// <returns></returns>
    List<EquipTypeBean> GetEquipTypeBeans();

    /// <summary>
    /// 修改设备可用性
    /// </summary>
    /// <param name="updateEquipPara"></param>
    /// <param name="userId"></param>
    /// <param name="userName"></param>
    /// <param name="clientip"></param>
    /// <returns></returns>
    int UpdateEquipEnable(UpdateEquipPara updateEquipPara, long userId, string userName, string clientHost);
    /// <summary>
    /// 删除堆垛机出库订单和任务
    /// </summary>
    /// <param name="equipId"></param>
    /// <returns></returns>
    int DeleteCrnOutOrder(long equipId);

    /// <summary>
    /// 设备状态
    /// </summary>
    /// <param name="equipStatusPara"></param>
    /// <returns></returns>
    List<EquipStatusBean> GetEquipStatusBeans(EquipStatusPara equipStatusPara);

    /// <summary>
    /// 设备报警历史记录
    /// </summary>
    /// <returns></returns>
    List<EquipErrBean> GetEquipErrHistoryBeans(EquipErrPara equipErrPara);

    /// <summary>
    /// 设备报警历史记录
    /// </summary>
    /// <returns></returns>
    List<EquipErrBean> GetEquipNoFinishErrBeans();
    /// <summary>
    /// 得到堆垛机设备
    /// </summary>
    /// <returns></returns>
    List<EquipBean> GetCrnEquipBeans();
    /// <summary>
    /// 得到硫化机设备
    /// </summary>
    /// <returns></returns>
    List<EquipBean> GetCurEquipBeans();
    /// <summary>
    /// 得到硫化机设备
    /// </summary>
    /// <returns></returns>
    List<EquipBean> GetCurEquipCodeBeans();
    /// <summary>
    /// 获取设备网络状态
    /// </summary>
    /// <param name="equipNetWorkStatusPram"></param>
    /// <returns></returns>
    List<EquipNetWorkStatusBean> GetEquipNetWorkStatusBeans(EquipNetWorkStatusPram equipNetWorkStatusPram);
    /// <summary>
    /// 堆垛机获取 PDA入库取胎位状态
    /// </summary>
    /// <param name="CrnId"></param>
    /// <returns></returns>
    LocEnableBean GetLocEnableByCrnId(long crnId);

}
public class UpdateEquipPara
{
    public long Id { get; set; }
}
public class EquipErrPara
{
    /// <summary>
    /// 设备名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 报警开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// 报警结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }
}
public class EquipErrBean
{
    public long Id { get; set; }
    /// <summary>
    /// 设备编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 设备名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 报警编号
    /// </summary>
    public int? ErrCode { get; set; }

    /// <summary>
    /// 报警信息
    /// </summary>
    public string ErrMsg { get; set; }
    /// <summary>
    /// 报警开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }
    /// <summary>
    /// 报警结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }
    /// <summary>
    /// 总报警时长(s)
    /// </summary>
    public double ErrorTotalTime { get; set; }

}

public class EquipStatusPara
{
    /// <summary>
    /// 设备名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 任务编号
    /// </summary>
    public int? TaskNo { get; set; }
}

public class EquipStatusBean
{
    public long Id { get; set; }
    /// <summary>
    /// 设备编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 设备名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 任务编号
    /// </summary>
    public int TaskNo { get; set; }
    /// <summary>
    /// 任务状态
    /// </summary>
    public string TaskStatusName { get; set; }
    /// <summary>
    /// 设备状态
    /// </summary>
    public string Status { get; set; }
    /// <summary>
    /// 报警编号
    /// </summary>
    public int? ErrCode { get; set; }
    /// <summary>
    /// 是否报警
    /// </summary>
    public string IsErrCode { get; set; }
    /// <summary>
    /// 报警信息
    /// </summary>
    public string ErrMsg { get; set; }
}

public class EquipTypeBean
{
    public long Id { get; set; }
    /// <summary>
    /// 类型名称
    /// </summary>
    public string Name { get; set; }
}
public record LocEnableBean
{
    /// <summary>
    /// 取胎位1可用[1:可用；0：不可用]
    /// </summary>
    public int LocEnable1 { get; set; }
    /// <summary>
    /// 取胎位2可用[1:可用；0：不可用]
    /// </summary>
    public int LocEnable2 { get; set; }
}
public class EquipBean
{
    /// <summary>
    /// 设备ID
    /// </summary>
    public long Id { get; set; }
    /// <summary>
    /// 类型名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 设备编码
    /// </summary>
    public string Code { get; set; }

    public override bool Equals(object? obj)
    {
        return obj is EquipBean bean &&
               Code == bean.Code;
    }

    public override int GetHashCode()
    {
        return HashCode.Combine(Code);
    }
}
public class EquipManagePara
{
    /// <summary>
    /// 设备类型
    /// </summary>
    public long? TypeId { get; set; }
    /// <summary>
    /// 设备名称
    /// </summary>
    public string EquipName { get; set; }
    /// <summary>
    /// 设备可用性
    /// </summary>
    public string EquipEnable { get; set; }
}
public class EquipManageBean
{
    public long Id { get; set; }
    /// <summary>
    /// 设备编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 设备名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public string TypeName { get; set; }
    /// <summary>
    /// 设备状态
    /// </summary>
    public string Status { get; set; }
    /// <summary>
    /// 设备状态
    /// </summary>
    public bool IsStatus { get; set; }
    /// <summary>
    /// 报警编号
    /// </summary>
    public int? ErrCode { get; set; }
    /// <summary>
    /// 报警信息
    /// </summary>
    public string ErrMsg { get; set; }
}
public class EquipNetWorkStatusPram
{
    /// <summary>
    /// 设备名称
    /// </summary>
    public string equipName { get; set; }
    /// <summary>
    /// 设备IP
    /// </summary>
    public string equipIP { get; set; }
}
public class EquipNetWorkStatusBean
{
    /// <summary>
    /// 设备Code
    /// </summary>
    public string EquipCode { get; set; }
    /// <summary>
    /// 设备名称
    /// </summary>
    public string EquipName { get; set; }
    /// <summary>
    /// 上次断线时间
    /// </summary>
    public string Tips { get; set; }
    /// <summary>
    /// 设备IP
    /// </summary>
    public string EquipIP { get; set; }
    /// <summary>
    /// 网络状态
    /// </summary>
    public string NetWorkStatus { get; set; }
    /// <summary>
    /// 网络状态标志
    /// </summary>
    public int Status { get; set; }
}
